#include<stdio.h>
#define Maxsize 50
typedef char ElementType;
typedef struct SNode *PtrToSNode;
struct SNode {
    ElementType Data[100];   
    int Top;       
};
typedef PtrToSNode Stack;
int Push(Stack &S, char e); 
void InitStack(Stack &S);
bool Pop(Stack &S,char &e);
void change(Stack &op,Stack &postexp,char exp[]);
void printfh(Stack S);
bool getup(Stack &S,char &e);
int main(){
	Stack op,postexp;
	char a[100];
	int i=0,j=0;
	scanf("%s",a);
	InitStack(op);InitStack(postexp);
	Push(op,'=');
	change(op,postexp,a);
	printfh(postexp);
	return 0;
	
}
int Push(Stack &S, char e){
	if(S->Top==Maxsize-1) return false;
	S->Top++;
	S->Data[S->Top]=e;
	return true;
}
void InitStack(Stack &S){
	S=new SNode;
	S->Top=-1;
}
bool Pop(Stack &S,char &e){
	if(S->Top==-1) return false;
	e=S->Data[S->Top--];
	return e; 
}
void change(Stack &op,Stack &postexp,char exp[]){
	int i=0,flag=0;
	char e1,e2;
	while(exp[i]!='\0'){
		if(i==0&&(exp[i]=='-'||exp[i]=='+')){
			Push(postexp,exp[i]);
			i++;
		}
		if((exp[i]=='-')&&exp[i-1]=='('){
			Push(postexp,exp[i]);
			Push(postexp,'!');
			i++;
		}
		if((exp[i]=='+')&&exp[i-1]=='('){
			i++;
			continue;
		}
		while(exp[i]>='0'&&exp[i]<='9'){
			Push(postexp,exp[i]);
			i++;
			flag=1;
		}
		if(flag==1&&exp[i]!='.'){
			Push(postexp,'#');
			flag=0;
		}
		if(exp[i]=='.'){
			Push(postexp,exp[i]);
		}
		if(exp[i]<'0'||exp[i]>'9'){
			if(exp[i]=='+'||exp[i]=='-'){
				getup(op,e1);
				while(e1!='='&&e1!='('){
					Pop(op,e2);
					Push(postexp,e2);
					getup(op,e1);
				}
				Push(op,exp[i]);
			}
			else if(exp[i]=='*'||exp[i]=='/'){
				getup(op,e1);
				while(e1=='*'||e1=='/'){
					Pop(op,e2);
					Push(postexp,e2);
					getup(op,e1);
				}
				Push(op,exp[i]);		
			}
			else if(exp[i]=='('){
				Push(op,exp[i]);
			}
			else if(exp[i]==')'){
				getup(op,e1);
				while(e1!='('){
					Pop(op,e2);
					Push(postexp,e2);
					getup(op,e1);
				}
				Pop(op,e2);
			} 
		}
	i++;
	}
	while(op->Top!=-1){
		Pop(op,e1);
		Push(postexp,e1);
	}
}
void printfh(Stack S){
	int i=0;
	if(S->Top==-1) return;
		for(i=0;i<S->Top;i++){
			if(i==S->Top-1) {
				if(S->Data[i]=='#') continue;
				else{
					printf("%c",S->Data[i]);
				}
			}
			else if(S->Data[i]=='!') continue;
			else if(S->Data[i]=='#'&&i!=S->Top-1) printf(" ");
			else if(S->Data[i]>='0'&&S->Data[i]<='9') printf("%c",S->Data[i]);
			else{
				if(i==0&&(S->Data[i]=='-'||S->Data[i]=='+')) printf("%c",S->Data[i]);
				else if(S->Data[i]=='-'&&S->Data[i+1]=='!') printf("%c",S->Data[i]);
				else if(S->Data[i]=='.') printf("%c",S->Data[i]);
				else printf("%c ",S->Data[i]);
				
			}
		}
}
bool getup(Stack &S,char &e){
	if(S->Top==-1) return false;
	e=S->Data[S->Top];
	return true;
}
